<!DOCTYPE html>
<html>
<head>
<script src="../../resources/js-test.js"></script>
</head>
<body>
<script>
description("Verify that MediaStreamTracks aren't prematurely garbage collected.");

if (window.testRunner)
    testRunner.dumpAsText();

var jsTestIsAsync = true;

function finishUp() {
    gc();
    finishJSTest();
}

navigator.webkitGetUserMedia({audio: false,video: true},
    // success callback
    function (stream) {
        var vidTrack = stream.getVideoTracks()[0];
        vidTrack.onended = function () {};
        testPassed("getUserMedia returned with stream containing a valid video track");
        finishUp();
    },
    // error callback
    function () {
        testFailed("getUserMedia returned with an error");
        finishUp();
    }
);
</script>
</body>
</html>
